<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once('Entity/Doc_Tags_Doc_Entity.php');        
class Doc_Tags_Doc_Model extends Doc_Tags_Doc_Entity
{  
    public function __construct()
    {
        parent::__construct();
    }
    
    public function addnewDocTag($docId, $tagId)
    {
        $this->setDoc_id($docId);
        $this->setTag_id($tagId);
        return $this->save();
    }
    
    public function updateTags($docId, $arrTag)
    {
        $this->db->delete('doc_tags_doc', array('doc_id' => $docId));
        foreach ($arrTag as $tag) {
            $this->setDoc_id($docId);
            $this->setTag_id($tag);
            $this->save();
        }
    }
}